home *** CD-ROM | disk | FTP | other *** search
-
- -- a STACK is a LIFO (last in, first out) collection.
- -- Time complexity for data adding is O(1).
- -- Time complexity for data searching is O(1).
- -- Space complexity is O(n).
-
- indexing
-
- names: stack;
- contents: generic;
-
- author: "Guichard Damien";
- created: 9,November,1995;
- modified: 9,November,1995
-
- class STACK inherit BAG
- rename add as push, next as top
- export {NONE} find
- end
- feature
- pop is
- -- Remove top element of the stack.
- do
- if next /= Void then
- next := next.next
- end
- end -- pop
- end -- class 'STACK'
-
-